#!/bin/bash

set -e

FWPATH="../../ARM/STM_Eclipse/BLDC_4_ChibiOS/"
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

rm -rf $FWPATH/package/*

cd $FWPATH
make all_fw_clean
make all_fw -j24
sleep 1
python3 package_firmware.py
make all_fw_clean

cd $DIR
rm -r res/firmwares/*
cp -r $FWPATH/package/* res/firmwares/
cp $FWPATH/CHANGELOG.md res/firmwares

rm -r $FWPATH/package/*

